/*
 * This class models all enviroments variables :)
 * NOTE: use static attributes/methods
 */

package im.general;

/**
 *
 * @author Gnaskky
 */
public final class Config {
    public final static int 
            GETSTATUS=0, STATUS=2,
            PUBLISH = 10, NOTIFY=11, PUBLISH_CH=12, SUBSCRIBE=13;

    public final static String NOTIFY_NAME = "Notify";
    public final static String PUBLISH_NAME = "Publish";
    public final static String SUBSCRIBE_NAME = "Subscribe";
    public final static String UPDATE_STATUS_NAME = "Update Status";
    public final static String NOTIFY_RECIPIENTS = "Notify Recipients";
    public final static String NOTIFY_RECIPIENT = "Notify Recipient";

    public final static int MAX_CLUSTER_SIZE = 4;
    public final static int MIN_CLUSTER_SIZE = 3;

    public final static String EVENT_SERVICE_NAME = "EventService";
    public final static String CH_ROOT_NAME = "CH_0";

    /* Here follows all IM customized message ids */
    public final static String IM_MSG_TYPE = "IM_MSG_TYPE";
    public final static String IM_RMSG_TYPE = "IM_RMSG_TYPE";
    public final static String NEW_CH_NAME = "NEW_CH_NAME";
    public final static String NEW_CH_CONTAINER = "NEW_CH_CONTAINER";
    public final static String OLD_MN_NAME = "OLD_MN_NAME";

    /* Here follows all IM customized message types
     * use in combo with: IM_MSG_TYPE
     * */
    public final static String GET_CHS_MSG = "GET_CHS_MSG";
    public final static String POST_CHS_MSG = "POST_CHS_MSG";

    public final static String SRVC_JOIN_REQ_MSG = "SRVC_JOIN_REQ_MSG";
    public final static String SRVC_JOIN_NOTIFY_MSG = "SRVC_JOIN_NOTIFY_MSG";
    public final static String SRVC_UNJOIN_NOTIFY_MSG = "SRVC_UNJOIN_NOTIFY_MSG";

    public final static String NEW_CH_NOTIFY_MSG = "NEW_CH_NOTIFY_MSG";
    public final static String NEW_CH_ADVERTISE_MSG = "NEW_CH_ADVERTISE_MSG";

    public final static String CH_SHRINK_NOTIFY_MSG = "CH_SHRINK_NOTIFY_MSG";
    public final static String SHRINK_NOTIFY_MSG = "SHRINK_NOTIFY_MSG";

    /* Here follows parameters for handling clustering policies */

    public final static int CLUSTER_RANDOM = 1;
    public final static int CLUSTER_HEURISTIC = 2;
    public final static int CLUSTER_POLICY = CLUSTER_HEURISTIC;

    /* Here follows parameters for handling output levels */

    public final static int SHY_TR_LVL      = 10;
    public final static int NORMAL_TR_LVL   = 100;
    public final static int HIGH_TR_LVL     = 1000;
    public final static int ULTRA_TR_LVL    = 10000;
    public final static int EXTREME_TR_LVL  = 100000;
    public final static int NIGHTMARE_TR_LVL= 500000;

    public final static int TRACE_LVL = NORMAL_TR_LVL + 1;

    /* Here follows paratmeters for simulation*/

    public final static double  VARIABILITY              = 0.5; //please dont touch :)

    public final static double  MIN_CAPABILITIES         = 0.05;
    public final static double  MAX_CAPABILITIES         = 1.1;

    public final static double  PARAMETER_MEAN_COEFF     = 1.0;
    public final static double  PARAMETER_VAR_COEFF      = 0.05;
    public final static double  BW_VAR_COEFF             = 0.15;

    public final static long    TIME_SCALE               = 1000L;  // if = 1000, normal scale :)

    public final static int     MAX_NUM_CONTEINERS       = 10;
    public final static double  PUBLISHER_PROBABILITY    = 0.5;
    public final static double  LAMBDA_NODE_GENERATION   = 1;       // NUM CLIENT / SEC
    public final static long    SEED_DISTR               = 1L;
    public final static double  PUBLISHING_RATE          = 0.05;    // event/sec
    public final static long    UPDATE_RESOURCE_FREQ_SEC = TIME_SCALE;

    public final static double  OS_RES_FRACTION_MEAN = 0.1;
    public final static double  OS_RES_FRACTION_VAR = 0.02;
    public final static double  USR_RES_FRACTION_MEAN = 0.2;
    public final static double  USR_RES_FRACTION_VAR = 0.1;
    public final static double  NET_LOAD_FRACTION_MEAN = 0.2;
    public final static double  NET_LOAD_FRACTION_VAR = 0.2;

    public final static double  NODE_CAPABILITY_MEAN = 0.4;
    public final static double  NODE_CAPABILITY_VAR = 0.55;

    public final static double  ATT_NODE_RAM_MEAN = 512.0; //512 Kb
    public final static double  ATT_NODE_RAM_VAR = 256.0;
    public final static double  ATT_NODE_CPU_MEAN = 10.0; //10Mhz
    public final static double  ATT_NODE_CPU_VAR = 50.0;  //
    public final static double  ATT_NODE_DISK_MEAN = 1.0; //1MB
    public final static double  ATT_NODE_DISK_VAR = 1.0;
    public final static double  ATT_NODE_BW_MEAN = 128.0; // 128 Kbps
    public final static double  ATT_NODE_BW_VAR = 128.0;  // 128

    protected final static double  NODE_CHARGE_LIFE_MEAN_MSEC =  1*60*60*1000; // 1h -> msec
    public final static double  NODE_CPU_BW_DISCHARGE_RATIO =  0.5; // 50/50

    public final static double  NODE_CHARGE_LIFE_MEAN_THICKS = NODE_CHARGE_LIFE_MEAN_MSEC/UPDATE_RESOURCE_FREQ_SEC;

    /* Event Service Phisical Featurs */
    public final static double ES_PHY_BW_KBPS       = 100000.0; // 100Mbps
    public final static double ES_PHY_BATTERY       = 5000.0;   // is dummy value: ES is fixPlugged :)
    public final static int    ES_PHY_CPU_MHZ       = 4000;     // 4Ghz
    public final static int    ES_PHY_DISK_MB       = 4096;     // 4Gb
    public final static int    ES_PHY_RAM_MB        = 100000;   // 100 GB

    /* Heuristic Constaints for statusIndex estimation */
    protected final static double STAT_IDX_CHARGE_ADJF   = 1.0;
    protected final static double STAT_IDX_BANDW_ADJF    = 1.0;
    protected final static double STAT_IDX_CPU_ADJF      = 1.0;
    protected final static double STAT_IDX_DISK_ADJF     = 0.1;
    protected final static double STAT_IDX_RAM_ADJF      = 0.5;

    public final static double STAT_IDX_PLUGGED_WEIGHT  = STAT_IDX_CHARGE_ADJF  * 1.5;
    public final static double STAT_IDX_CHARGE_WEIGHT   = STAT_IDX_CHARGE_ADJF  * 1.0/20.0000;  // max* = 20000 mAh
    public final static double STAT_IDX_BANDW_WEIGHT    = STAT_IDX_BANDW_ADJF   * 1.0/1000.0000;// max* = 1000000 Kbps
    public final static double STAT_IDX_CPU_WEIGHT      = STAT_IDX_CPU_ADJF     * 1.0/4.0000;   // max* = 4000 mHz
    public final static double STAT_IDX_DISK_WEIGHT     = STAT_IDX_DISK_ADJF    * 1.0/300.0000; // max* = 300000 Mb
    public final static double STAT_IDX_RAM_WEIGHT      = STAT_IDX_RAM_ADJF     * 1.0/4.0960;   // max* = 4096 Mb


    public final static double STAT_DELTA_RATIO_MIN_WRAP = 0.15;

    /* Logging */

    public final static String LOGGING_DIRECTORY = "logging_files";
    public final static String EVENT_SERVICE_LOG_FILE = "EventServiceLog.txt";
    public final static String CLUSTER_HEAD_LOG_FILE = "ClusterHeadLog";

}
